#file name: Makefile
#Last change: Mar 26 2020

all: system
	objcopy -I elf64-x86-64 -S -R ".eh_frame" -R ".comment" -O binary system kernel.bin

system: head.o main.o
	ld -b elf64-x86-64 -z muldefs -o system head.o main.o printk.o -T Kernel.lds

head.o:	head.S
	gcc -E  head.S > head.s
	as --64 -o head.o head.s

main.o: main.c
	gcc -mcmodel=large -fno-builtin -m64 -c main.c

printk.o: printk.c
	gcc -mcmodel=large -fno-builtin -m64 -c printk.c

clean:
	rm -rf *.o kernel.bin
	